<?php

/*

Process Pet Names (pet_names.pro.php)

*/
ob_start();
$rank_check = 1;
include "header.inc.php";

$check = fetch("SELECT * FROM user_pets2 WHERE name = '$edit_name' AND game = '$game'");
if ($check[name])
{
	die(header(error("pet_names.php?game=$game&id=$id","There is already a pet with that name. Try another name.")));
}
if ($edit_name == "")
{
	die(header(error("pet_names.php?game=$game&id=$id","Don't leave the name blank.")));
}
if ($points < 500)
{
	die(header(error("pet_names.php?game=$game&id=$id","You must have 500 $pointVar to change your pets name!")));
}
if (preg_match('/^[a-zA-Z0-9_]*$/UD',$edit_name))
{
	mysql_query("UPDATE user_pets2 SET name = '$edit_name' WHERE owner = '$userid' AND id = '$id' AND game = '$game'");
	points($game,$username,-500);
}
else
{
	die(header(error("pet_names.php?game=$game&id=$id","Please only use letters A-Z, a-z, and 0-9.")));
}

header(error("pet_names.php?game=$game&id=$id","Your pet name has been updated."));

?>
